import QtQuick 2.6
import QtQuick.Controls 2.1

RadioButton {
    id: control
    text: qsTr("RadioButton")
    checked: true

    property string textcolor:"#FF000000"
    property string disabledtextcolor:"#FFA7A6AA"
    property string selectedtextcolor:"#FFFFFFFF"


    property string normalimage: ""
    property string hotimage: ""

    property string foreimage: ""
    property string hotforeimage:""
    property string selectedforeimage:""
    property string selectedimage:""

    indicator: Rectangle {
        implicitWidth: 26
        implicitHeight: 26
        //x: control.leftPadding
        //y: parent.height / 2 - height / 2
        radius: 13
        border.color: control.down ? "#17a81a" : "#21be2b"

        Image
        {
            width: control.width
            height: control.height
            source:
            {
                if(control.checked)
                {
                    selectedimage
                }
                else{
                    if(control.hovered)
                    {
                        hotimage
                    }
                    else
                    {
                        normalimage
                    }

                }
            }
        }
        Image
        {
            x: 7
            y: 7
            width: 20
            height: 20
            source:
            {
                if(control.checked)
                {
                    selectedforeimage
                }
                else
                {
                    if(control.hovered)
                    {
                        hotforeimage
                    }
                    else
                    {

                        foreimage
                    }
                }
            }
        }
    }

    contentItem: Text {
        text: control.text
        font: control.font
        opacity: enabled ? 1.0 : 0.3
        color:{
            if(control.checked){
                selectedtextcolor
            }else{

                textcolor
            }
        }
        verticalAlignment: Text.AlignVCenter
        leftPadding: control.indicator.width + control.spacing
    }
}
